package com.rongxun.hbwallet.ui.activities;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.rongxun.base.MvpActivity;
import com.rongxun.hbwallet.R;
import com.rongxun.hbwallet.constants.ConfigKey;
import com.rongxun.hbwallet.mvp.contract.IMenttionMeesage;
import com.rongxun.hbwallet.mvp.model.ApiModel;
import com.rongxun.hbwallet.mvp.presenter.MentionMessagePresenter;
import com.rongxun.utils.StatusBarUtil;
import com.rongxun.widget.MentionMoneyDialog;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 创建者     庄丰泽
 * 创建时间   2018/8/10 14:24
 * 描述	     CITY COIN提币页面
 */
public class MentionMoneyActivity extends MvpActivity<IMenttionMeesage.IView,MentionMessagePresenter> implements IMenttionMeesage.IView{
    @BindView(R.id.toolbar_title)
    TextView  mToolbarTitle;
    @BindView(R.id.toolbar_back)
    ImageView mToolbarBack;
    @BindView(R.id.toolbar)
    Toolbar   mToolbar;
    @BindView(R.id.toolbar_right_text)
    TextView right_text;
    @BindView(R.id.MentionMoney_ed_input)
    EditText ed_money_number;
    @BindView(R.id.can_mention_money)
    TextView tv_can_mention_money;
    private double money_number;
    private double Miners_fee;
    private double mini_money;
    @Override
    protected void init() {
        StatusBarUtil.setToolBarPaddingTop(mToolbar, this);
        mToolbarBack.setVisibility(View.VISIBLE);
        mToolbarTitle.setText(getString(R.string.CITY_Mention_money));
        mToolbarBack.setVisibility(View.VISIBLE);
        right_text.setVisibility(View.VISIBLE);
        right_text.setText(getString(R.string.Mention_record));
        tv_can_mention_money.setText(String.format(getString(R.string.can_money),500));
    }
    @Override
    protected int getContentView() {
        return R.layout.activity_mentionmoney;
    }

    @Override
    public Context getContext() {
        return this;
    }

    @Override
    public void showLoading(boolean show) {

    }

    @Override
    public void showError(String msg, String errorCode) {

    }

    @Override
    public void checkPermissionsSuccessful(String... permissions) {

    }

    @Override
    public void release() {

    }

    @OnClick({R.id.toolbar_back,R.id.mention_but_money_all,R.id.toolbar_right_text})
    public void onViewClicked(View view) {
        switch (view.getId()){
            case R.id.toolbar_back:
                onBackPressed();
                break;
            case R.id.mention_but_money_all:
                getPresenter().getMentionMoneyMessage(money_number,Miners_fee);
                break;
            case  R.id.toolbar_right_text:
                getPresenter().getConfig(ConfigKey.TAKE_CITYTOKEN_LIMIT_NUM);
                break;
        }
    }

    @NonNull
    @Override
    public MentionMessagePresenter createPresenter() {
        return new MentionMessagePresenter(this, new ApiModel(this));
    }

    @Override
    public void startMentionMessageDialog(double money_number, double Miners_fee) {
        MentionMoneyDialog.Builder builder=new  MentionMoneyDialog.Builder(this);
        builder.setMiners_fee(Miners_fee);
        builder.setMoney_number(money_number);
        builder.create().show();
    }

    @Override
    public void setMiniMonney(String mini_money) {
        this.mini_money=Double.valueOf(mini_money);
    }


}
